<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" name="" id="sum1" value="" />
		<select id="sum">
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
		</select>
		<input type="text" name="" id="sum2" value="" />
		<button type="button" onclick="tosum();">运算</button>
		<input type="text" name="" id="sum3" value="" />
	</body>
	<script type="text/javascript">
		function tosum(){
			var s1 =document.getElementById('sum1').value;
		var s2 =document.getElementById('sum2').value;
		var select1 =document.getElementById('sum');
		var index =select1.selectedIndex;
		var aa =select1.options[index].value;
		document.getElementById('sum3').value=eval(s1+aa+s2);
		}
	</script>
</html>
